﻿<%@ Page Title="Profile" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" 
    CodeBehind="Profile.aspx.cs" Inherits="HoneyBadgersOfficePlayer.Views.Profile" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript">

var sendReq = getXmlHttpRequestObject();
var receiveReq = getXmlHttpRequestObject();

function getXmlHttpRequestObject() 
{
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';
    }
}

function Ratings_LostFocus(index) {
    //var txt = document.getElementByID('Ratings');
    //alert(txt.value);

    //var rowIndex = getIndex('<%# ((GridViewRow) Container).RowIndex %>')
    //alert(rowIndex);

    var songID='';
    var Grid_Table = document.getElementById('<%= GridView1.ClientID %>');
    alert('<%= GridView1.ClientID %>');
    if(document.all)
        songID=songID+Grid_Table.rows[index].cells[5].innerText;
    else
        songID=songID+Grid_Table.rows[index].cells[5].textContent;
    songID=songID+'\n';
    alert(songID);

    if (sendReq.readyState == 4 || sendReq.readyState == 0) {
        var param = '&songID=songID';
        param += '&newRating=newRating';
        sendReq.open("POST", 'UpdateSongRating.aspx?songID=' + songID + '&newRating=' + newRating, true);
        sendReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        sendReq.onreadystatechange = handleSend;
        sendReq.send(param);
    }
}

function handleSend() 
{
    if (receiveReq.readyState == 4 || receiveReq.readyState == 0)
    {
        receiveReq.open("GET", 'UpdateSongRating.aspx', true);
        receiveReq.onreadystatechange = handleReceiveChat;
        receiveReq.send(null);
    }			
}
</script>
</asp:Content>
    
<%--</asp:Content>--%>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

  <%--<h1>Profile</h1>--%>
  <div class="hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                    <items>
                    
                        <asp:MenuItem NavigateUrl= "~/Views/Rooms.aspx" Text="Rooms" ToolTip="Rooms" ></asp:MenuItem>

                        <asp:MenuItem NavigateUrl= "~/Views/Upload.aspx" Text="Upload" ToolTip="Upload" ></asp:MenuItem>

                        <asp:MenuItem NavigateUrl= "~/Views/Library.aspx" Text="My Music" ToolTip="My Music" ></asp:MenuItem>

                        <asp:MenuItem NavigateUrl= "~/Views/Admin.aspx" Text="Admin" ToolTip="Admin"  ></asp:MenuItem>
                    </items>
                </asp:Menu>
            </div>
 <div class="container">
   <div class="user_profile" >
        <fieldset class="register">
                            <legend>Profile</legend>
                            <p>
                            <asp:Label ID="Username" runat="server">Username</asp:Label>
                            </p>
                            <p>User Email</p>
                            <p>
                            <asp:TextBox ID="User_Email" runat="server" CssClass="textEntry"></asp:TextBox>
                            </p>
                            <p>First Name</p>
                            <p>
                            <asp:TextBox ID="First_Name" runat="server" CssClass="textEntry"></asp:TextBox>
                            </p>
                            <p>Last Name</p>
                            <p>
                            <asp:TextBox ID="Last_Name" runat="server" CssClass="textEntry"></asp:TextBox>
                            </p>
                            <p>Address</p>
                            <p>
                            <asp:TextBox ID="Address" runat="server" CssClass="textEntry"></asp:TextBox>
                            </p>
                            <p>City</p>
                            <p>
                            <asp:TextBox ID="City" runat="server" CssClass="textEntry"></asp:TextBox>
                            </p>
                            <p>State</p>
                            <p>
                            <asp:TextBox ID="State" runat="server" CssClass="textEntry"></asp:TextBox>
                            </p>
                            <p>Zip Code</p>
                            <p>
                            <asp:TextBox ID="ZipCode" runat="server" CssClass="textEntry"></asp:TextBox>
                            </p>
                            <p>Explicit Lyrics
                            <asp:CheckBox ID="Explicit" runat="server" AutoPostBack="false"></asp:CheckBox>
                            </p>
                             <p class="Button">
                            <asp:Button ID="Update_User_Info" runat="server" CssClass="menu" CommandName="Update_User_Info" Text="Update User Info" OnClick="Update_Info_Button_Click"/>
                </p>
        </fieldset>
        </div>
     
  <div class="user_ratings">
    <fieldset class="user_rating">
    <legend>User Rating</legend>
    <div style ="height: 536px; overflow:auto; width:425px " >
        
          <asp:GridView ID="GridView1"  runat="server" AutoGenerateColumns="false">
            <Columns>
                <%--<asp:TemplateField HeaderText="Update">
                   <ItemTemplate>
                     <asp:TextBox ID="Ratings" onblur="Ratings_LostFocus(70)" runat="server" Width="30px"></asp:TextBox>
                 </ItemTemplate>
                 </asp:TemplateField> --%>
                 
                 <asp:BoundField DataField="Ratings" HeaderText="Ratings" Visible="true" ReadOnly="true"  ></asp:BoundField>
                 <asp:BoundField DataField="Artist" HeaderText="Artist"  Visible="true" ReadOnly="true"  ></asp:BoundField>
                 <asp:BoundField DataField="Song"   HeaderText="Song"  Visible="true" ReadOnly="true"  ></asp:BoundField>
                 <asp:BoundField DataField="Genre"  HeaderText="Genre"  Visible="true" ReadOnly="true"  ></asp:BoundField>
                 <%--<asp:BoundField DataField="SongID" HeaderText="SongID"  Visible="true" ReadOnly="true"  ></asp:BoundField>--%>
                 

                 
            </Columns>
          </asp:GridView>
     </div>
      </fieldset>
    </div>
    
<%--code to add an avatar or pic 
    not in use currently --%>      
<%--<div class="clear"></div>
  <div class="pic">
     <img src="C:\~code\honeybadger.jpg" alt="HoneyBadger" />
  </div>--%>

</div>
</asp:Content>
